package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class LahuoConfig {

	// ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092400585185";

	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC2aZ2Jc/NTFvLj0hHcfv/PFFSgEt+fvOgrSGGiwQlhGq8FyVbBRTmlI5ieiD3quxlmdnDqKSwhUDV6cwGsgC7FjP9ONygnM1oRFvWGRCky0VwHaO/pBAuvSG0VuBSz+xUQtiUZJtFwRTBvpGvJbkOchVqxsjdOUI0UyJa5JCJZEjLfhKadrpQHnzx09ePcU/8TD2JrY+J04XpJRdxHkBWisq6qMrVYD2z3W6H1oy4bfaUhueaeuF4h9MTAqBvzVnvDQ7sLrTW4Y/92+i+CZImZF/pfHDKHEBBNkpCC2N93rKp4rBg8PzFKzCV2x9ovl2dVvR6yC0Z+VCqDcBsJ0p2bAgMBAAECggEBAK3HUmjXiPEYhM8bmx6H8uZyBOj28gn46uoJK9Lkui3DQQhvNnIro+46SjSFsQ8Frf4aShoanUsjYb9E/0w6VdSoLbVzAJLP7jcnu0Jtfx5Fq7n3c892pjcX9axiUX7hbcEc9ZzPiWm+0JUbfABLRqg/txZgpSW7wZwSON0qmnplKfnqUqEH5L8HDIBFnWILZT4GnOYu1ohq6A6O9mu9CQS2AzuvInii+lEFCeZM47+9OEuhNs+D9C1AZjtDZPDRhV7CNKEDxW3SDjwo1DzNZ6xdNmP9cIbMaS5w8A0x1hhuzMJxPD6IWLricuc3rjyRF26QIXGhrlWbJS5HNPXRvekCgYEA6g7Dt3m6hpBszTsePuL12FfFBf8wSgsRLXJarQ0yKz6ru07YGBif7Gy3oFNtGxd2ahw2+GLGuQy6cpEulaeq3eiVTnZbPSFtp0Hcn1v8EcVQMGfAhPUAXz8U/aC5yaYxfBeMmACmxWM2F+juW/V0PdTvfEvBy8rb2DdGdHu+618CgYEAx4Nmo9ZviX2gh0wavhkKBEzJ+EIVr2LVTfxWbltdKYHT5w2eoPjGG6vE8r+P0Qo3NjI1314iBWKOcsJjgmp2ItdO/jYikOqLT5/vcAWZZxyHHMQiW7llOBhmftYoRdGobUKSbr8Bpky10Y1dBP1N8slZ3QavTBV/RbU9E6FO80UCgYEAlGMp589P1vIHWJHLWhkvvanfai7gIYEkschW/nFoRgxkecrBq30pHo3KWOWrPUrBswISQ6Tz0evk5K9wdkanSCqlReo5a+ceirRxt8Jsa6PJc/bDEkf1pWzr1OQqBVLM+pw/cTqwgGGmsL/nJfvWZ0DxV777rUT93fUlQMIXR0cCgYAxWpwFY4Jr7JvNXFIxPFhx/9zmgNKEdFp31Dg9THSbU/Zrbb8T6vZ22eL6edDF0VUfHwScoNihpGPAl72uAVAABmsQD6w1VQ/pPpMojvoHu9LgltQ5BH+5hK+2KJwFyXt0q8c1hiKOVOOVVvbvyQmDSbPlLUYn+Bln0RGuzXSOUQKBgQDPgVyH1NDl2aMkHBB7Kz/iPQRT2E8pqcaAOPMO4ARaR5iPkUFT+9oEF51A6W6LW1egtJC8dBfjWm0gvlcomkG+u01CRUFG9sSwF5Z0mNHr1zHw8TJs49D4lSLa8FguvW566UfkamWfNkadg3AN067j+5oOnA2wZrkqj/7P5rlO8w==";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm
	// 对应APPID下的支付宝公钥。
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmmdiXPzUxby49IR3H7/zxRUoBLfn7zoK0hhosEJYRqvBclWwUU5pSOYnog96rsZZnZw6iksIVA1enMBrIAuxYz/TjcoJzNaERb1hkQpMtFcB2jv6QQLr0htFbgUs/sVELYlGSbRcEUwb6RryW5DnIVasbI3TlCNFMiWuSQiWRIy34Smna6UB588dPXj3FP/Ew9ia2PidOF6SUXcR5AVorKuqjK1WA9s91uh9aMuG32lIbnmnrheIfTEwKgb81Z7w0O7C601uGP/dvovgmSJmRf6XxwyhxAQTZKQgtjfd6yqeKwYPD8xSswldsfaL5dnVb0esgtGflQqg3AbCdKdmwIDAQAB";

	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/lahuo/topays";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/lahuo/topays";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";

	// ↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * 
	 * @param sWord
	 *            要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
